#include "AniVector3.h"

#include <cmath>

#include "Constants.h"

AniVector3::AniVector3(Layer layer)
{
  double Hk,CosAni;
  Vector3 A;
  Hk=2*layer.getK()/layer.getMs()/Constants::MU0;
  A.setX(sin(layer.getAngleAni()/180*M_PI)*cos(layer.getAngleAni2()/180*M_PI));
  A.setY(sin(layer.getAngleAni()/180*M_PI)*sin(layer.getAngleAni2()/180*M_PI));
  A.setZ(cos(layer.getAngleAni()/180*M_PI));
  CosAni=A.dotProduct(layer.getMag());
  x=Hk*A.getX()*CosAni;
  y=Hk*A.getY()*CosAni;
  z=Hk*A.getZ()*CosAni;
}

AniVector3::~AniVector3()
{

}

//Careful cos(90) not equal to zero
